﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._08_桥接模式
{

    /// <summary>
    /// 运输方式抽象
    /// </summary>
    public abstract class ShippingMethod
    {
        protected ILogisticsCompany _logisticsCompany;

        protected ShippingMethod(ILogisticsCompany logisticsCompany)
        {
            _logisticsCompany = logisticsCompany;
        }


        public abstract void PrepareShipment();
        public abstract void ExecuteShipping();
        public abstract void CompleteShipping();

        public void SwitchCompany(ILogisticsCompany newCompany)
        {
            _logisticsCompany = newCompany;
            Console.WriteLine($"已切换物流公司至：{newCompany.GetCompanyName()}");
        }
        public void ShowTracking(string waybillNumber)
        {
            Console.WriteLine($"物流跟踪信息：{_logisticsCompany.TrackShipment(waybillNumber)}");
        }

    }
}
